package com.day04;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class TestArray {
	public static Integer[] toInteger(Object[] arr){
		Integer[]  result = new Integer[arr.length];
		for(int i=0;i<arr.length;i++){
			result[i]=(Integer)arr[i];
		}
		return result;
	}
	public static void testList(){
		List<String> list =new ArrayList<String>();
		list.add("123");
		list.add("zlt");
		list.add("ddd");
		for(Object o:list){
			System.out.println(o);
		}
	}
	public static void testSet(){
		Set<Integer> set =new HashSet<Integer>();
		set.add(1);
		set.add(2);
		set.add(3);
		Iterator<Integer> it=set.iterator();
		while(it.hasNext()){
			System.out.println(it.next());
		}
	}
	public static void testMap(){
		Map<Integer,String> map =new HashMap<Integer,String>();
		map.put(1,"zhangyi");
		map.put(2,"zhangliteng");
		map.put(3,"chenyiran");
		map.put(4,"chenzhuo");
		map.put(5,"sss");
		String name=(String)map.get("zhang");
		System.out.println(name);
		Set set=map.entrySet();
		Iterator it=set.iterator();
		while(it.hasNext()){
			System.out.println(it.next());
		}
		for(Integer key:map.keySet()){
			String value=map.get(key);
		}
	}
	public static void main(String [] args){
		Object[] arr={1,2,3,4,5};
		Integer []arr1= toInteger(arr);
		for(Integer i:arr1){
			System.out.println(i);
		}
		testSet();
		testMap();
		testList();
	}

}
